package com.powernode.lambda.lambda;

import com.powernode.lambda.Student;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.function.IntBinaryOperator;
import java.util.function.IntPredicate;
import java.util.function.Supplier;

/**
 * 在Lambda02类的基础上使用JDK提供的函数式接口
 */
public class Lambda03 {
    public static void main(String[] args) {
        IntPredicate ob1 = a -> (a & 1) == 0;
        IntPredicate ob2 = a -> BigInteger.valueOf(a).isProbablePrime(100);
        Type2 ob3 = (a, b, c) -> a + b + c;
        IntBinaryOperator ob4 = (a, b) -> a - b;
        IntBinaryOperator ob5 = (a, b) -> a * b;
        Supplier<Student> ob6 = () -> new Student();
        Supplier<List<Student>> ob7 = () -> new ArrayList<Student>();
        Function<Student,String> ob8 = s -> s.getName();
        Function<Student,Integer> ob9 = s -> s.getAge();
    }

    @FunctionalInterface
    interface Type2{
        int rt(int a, int b, int c);
    }

}
